package com.hubox;

import com.hubox.vo.UserStatusVo;
import com.hubox.vo.UserVo;
import jakarta.validation.Valid;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.BindException;
import org.springframework.validation.Validator;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Validated
@RestController
@Slf4j
@RequestMapping("list")
public class ListController {
    @Autowired
    private Validator validator;

    //经测试，这种方式是不会进行校验的
    @RequestMapping("/notwork")
    public ResponseEntity sample(@Valid @RequestBody List<UserVo> userVoList) {
        log.info("accept request: {}", userVoList);
        return ResponseEntity.ok().build();
    }
}
